package com.dmgis.qxfw.dataservice.businessservice.qxinfo.controller;

import com.dmgis.qxfw.dataservice.businessservice.common.domain.Entites;
import com.dmgis.qxfw.dataservice.businessservice.common.domain.MyPoint;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.text.ParseException;
import java.util.ArrayList;

public class test {
    public static void main(String[] args) throws ParseException, IOException {
        URL url = new URL("http://113.247.231.116/HNZYQXService2/HNDataServicePluginServer/cd/210927140524.txt");
        BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
        StringBuffer sb = new StringBuffer();
        String line;
        while ((line = br.readLine()) != null) {
         sb.append(line);
        }
        String s = sb.toString();
        int i = s.indexOf("pos:");
        int j = s.indexOf("*");
        String pos = sb.toString().substring(i + 5, j);
        System.out.println(pos);
        String[] split = pos.split("#");
        String posColor = split[0];
        String[] posArr = split[1].split(",");
        ArrayList<MyPoint> myPoints = new ArrayList<MyPoint>();
        for (String s1 : posArr) {
            String[] ponit = s1.split(" ");
            MyPoint myPoint = new MyPoint(Double.parseDouble(ponit[0]),Double.parseDouble(ponit[1]));
            myPoints.add(myPoint);
        }
        Entites entites = new Entites();
        entites.setColor(posColor);
        entites.setPosArr(myPoints);
    }
    //  String posurl = conn.getCallPlugin("ContourService.InterpolationService", "GetPosFile",uniqueno+"|cd", "");
}
